//
//  Search+CoreDataClass.swift
//  RssFly
//
//  Created by shen on 2023/10/16.
//

import CoreData

@objc(Search)
public class Search: NSManagedObject {
    public var wrappedQuery: String {
        query ?? ""
    }

    static func create(
        in managedObjectContext: NSManagedObjectContext,
        profile: Profile,
        query: String
    ) -> Search {
        let search = self.init(context: managedObjectContext)
        search.id = UUID()
        search.profile = profile
        search.submitted = Date()
        search.query = query

        return search
    }
}

